package com.frogs.ucenter.v1.request;

import javax.servlet.http.HttpServletRequest;

import com.frogs.framework.web.HttpRequestInfo;
import com.frogs.system.util.ApiUrlParamEnum;
import com.frogs.system.web.api.request.Request;
import com.frogs.system.web.exception.RequestIllegalException;

public class UserMedicationAddRequest extends Request {

	private String drugName;
	
	private String dosage;
	
	private String useCondition;
	
	private String symptoms;
	
	private Integer userId;
	
	public UserMedicationAddRequest() {
	}
	
	@Override
	public void parse(HttpServletRequest request) {
		HttpRequestInfo requestInfo = new HttpRequestInfo(request);
		this.drugName = requestInfo.getParameter(ApiUrlParamEnum.drugName.getParamName(), "");
		this.dosage = requestInfo.getParameter(ApiUrlParamEnum.dosage.getParamName(), "");
		this.useCondition = requestInfo.getParameter(ApiUrlParamEnum.useCondition.getParamName(), "");
		this.symptoms = requestInfo.getParameter(ApiUrlParamEnum.symptoms.getParamName(), "");
		this.userId = requestInfo.getIntParameter(ApiUrlParamEnum.userId.getParamName(), 0);
		if (userId < 1) {
			throw new RequestIllegalException("error userId: " + userId);
		}
	}

	public String getDrugName() {
		return drugName;
	}

	public void setDrugName(String drugName) {
		this.drugName = drugName;
	}

	public String getDosage() {
		return dosage;
	}

	public void setDosage(String dosage) {
		this.dosage = dosage;
	}

	public String getUseCondition() {
		return useCondition;
	}

	public void setUseCondition(String useCondition) {
		this.useCondition = useCondition;
	}

	public String getSymptoms() {
		return symptoms;
	}

	public void setSymptoms(String symptoms) {
		this.symptoms = symptoms;
	}

	public Integer getUserId() {
		return userId;
	}

	public void setUserId(Integer userId) {
		this.userId = userId;
	}

}
